package sudroid.android.views;

import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import java.util.regex.Pattern;
import sudroid.AssertUtil;
import sudroid.TextUtils;

public class ViewUtil
{
  public static final SparseArray<String> VISIBILITY_ARRAY = new SparseArray(3);

  public static View $id(View paramView, int paramInt)
  {
    View localView = paramView.findViewById(paramInt);
    if (localView == null)
      localView = paramView.getRootView().findViewById(paramInt);
    return localView;
  }

  public static View $stag(View paramView, CharSequence paramCharSequence)
  {
    AssertUtil.checkNull(paramView);
    if ((TextUtils.isEmpty(paramCharSequence)) || (!Pattern.matches("\\d+(-\\d+)*", paramCharSequence)));
    String str;
    for (View localView = null; ; localView = $tag(paramView, str))
    {
      return localView;
      str = "root-" + paramCharSequence;
    }
  }

  public static View $tag(View paramView, Object paramObject)
  {
    View localView = paramView.findViewWithTag(paramObject);
    if (localView == null)
      localView = paramView.getRootView().findViewWithTag(paramObject);
    return localView;
  }

  static
  {
    VISIBILITY_ARRAY.append(8, "GONE");
    VISIBILITY_ARRAY.append(0, "VISIBLE");
    VISIBILITY_ARRAY.append(4, "INVISIBLE");
  }

  public static boolean isViewExistAndVisible(View paramView, int paramInt)
  {
    View localView = $id(paramView, paramInt);
    if ((localView != null) && (localView.getVisibility() == 0));
    for (int i = 1; ; i = 0)
      return i;
  }

  public static boolean isViewExistAndVisible(View paramView, Object paramObject)
  {
    View localView = $tag(paramView, paramObject);
    if ((localView != null) && (localView.getVisibility() == 0));
    for (int i = 1; ; i = 0)
      return i;
  }

  private static String printAllChildrenInfo(View paramView, String paramString, boolean paramBoolean1, boolean paramBoolean2)
  {
    AssertUtil.checkNull(paramView);
    StringBuilder localStringBuilder1 = new StringBuilder();
    String str2;
    String str4;
    label105: ViewGroup localViewGroup;
    int i;
    int j;
    if (TextUtils.isEmpty(paramString))
    {
      paramString = "root";
      StringBuilder localStringBuilder2 = localStringBuilder1.append(paramString).append(" : ");
      String str1 = String.valueOf(paramString);
      str2 = str1 + "-";
      if ((paramBoolean2) && (paramView.getTag() == null))
        paramView.setTag(paramString);
      String str3 = paramView.getClass().getName();
      StringBuilder localStringBuilder3 = localStringBuilder1.append(str3);
      if (!paramBoolean1)
        break label193;
      str4 = printViewInfo(paramView);
      StringBuilder localStringBuilder4 = localStringBuilder3.append(str4);
      if (((paramView instanceof ViewGroup)) && (!(paramView instanceof AdapterView)))
      {
        localViewGroup = (ViewGroup)paramView;
        i = 0;
        j = localViewGroup.getChildCount();
      }
    }
    while (true)
    {
      if (i >= j)
      {
        return localStringBuilder1.toString();
        i = 0;
        int k = TextUtils.showCharNum(paramString, 45);
        while (i < k)
        {
          StringBuilder localStringBuilder5 = localStringBuilder1.append("  ");
          i += 1;
        }
        break;
        label193: str4 = "";
        break label105;
      }
      View localView = localViewGroup.getChildAt(i);
      StringBuilder localStringBuilder6 = localStringBuilder1.append("\n");
      String str5 = String.valueOf(str2);
      String str6 = str5 + i;
      String str7 = printAllChildrenInfo(localView, str6, paramBoolean1, paramBoolean2);
      StringBuilder localStringBuilder7 = localStringBuilder6.append(str7);
      i += 1;
    }
  }

  public static String printChildrenInfo(View paramView, boolean paramBoolean)
  {
    return printAllChildrenInfo(paramView, null, 0, paramBoolean);
  }

  public static String printConstantViewVisibility()
  {
    StringBuilder localStringBuilder1 = new StringBuilder();
    StringBuilder localStringBuilder2 = localStringBuilder1.append("[");
    StringBuilder localStringBuilder3 = localStringBuilder1.append("GONE:").append(8);
    StringBuilder localStringBuilder4 = localStringBuilder1.append(", VISIBLE:").append(0);
    StringBuilder localStringBuilder5 = localStringBuilder1.append(", INVISIBLE:").append(4);
    StringBuilder localStringBuilder6 = localStringBuilder1.append("]");
    return localStringBuilder1.toString();
  }

  public static String printDetailChildrenInfo(View paramView, boolean paramBoolean)
  {
    return printAllChildrenInfo(paramView, null, 1, paramBoolean);
  }

  public static String printViewInfo(View paramView)
  {
    AssertUtil.checkNull(paramView);
    StringBuilder localStringBuilder1 = new StringBuilder();
    StringBuilder localStringBuilder2 = localStringBuilder1.append("{");
    StringBuilder localStringBuilder3 = localStringBuilder1.append("id:0x");
    String str1 = Integer.toHexString(paramView.getId());
    StringBuilder localStringBuilder4 = localStringBuilder3.append(str1);
    StringBuilder localStringBuilder5 = localStringBuilder1.append(" tag:");
    Object localObject = paramView.getTag();
    StringBuilder localStringBuilder6 = localStringBuilder5.append(localObject);
    ViewGroup.LayoutParams localLayoutParams = paramView.getLayoutParams();
    StringBuilder localStringBuilder7 = localStringBuilder1.append(" size:");
    String str2 = printViewSize(localLayoutParams);
    StringBuilder localStringBuilder8 = localStringBuilder7.append(str2);
    StringBuilder localStringBuilder9 = localStringBuilder1.append(" visibility:");
    SparseArray localSparseArray = VISIBILITY_ARRAY;
    int i = paramView.getVisibility();
    String str3 = (String)localSparseArray.get(i);
    StringBuilder localStringBuilder10 = localStringBuilder9.append(str3);
    StringBuilder localStringBuilder11 = localStringBuilder1.append("}");
    return localStringBuilder1.toString();
  }

  public static String printViewSize(ViewGroup.LayoutParams paramLayoutParams)
  {
    StringBuilder localStringBuilder1 = new StringBuilder();
    StringBuilder localStringBuilder2 = localStringBuilder1.append("{");
    if (paramLayoutParams != null)
    {
      StringBuilder localStringBuilder3 = localStringBuilder1.append("width:");
      String str1 = printViewSizeHelper(paramLayoutParams.width);
      StringBuilder localStringBuilder4 = localStringBuilder3.append(str1);
      StringBuilder localStringBuilder5 = localStringBuilder1.append(" height:");
      String str2 = printViewSizeHelper(paramLayoutParams.height);
      StringBuilder localStringBuilder6 = localStringBuilder5.append(str2);
    }
    StringBuilder localStringBuilder7 = localStringBuilder1.append("}");
    return localStringBuilder1.toString();
  }

  private static String printViewSizeHelper(int paramInt)
  {
    String str;
    if (paramInt == -1)
      str = "FILL";
    while (true)
    {
      return str;
      if (paramInt == -1)
      {
        str = "WRAP";
        continue;
      }
      str = String.valueOf(paramInt);
    }
  }

  public static void removeView(View paramView)
  {
    if (paramView.getParent() != null)
      ((ViewGroup)paramView.getParent()).removeView(paramView);
  }

  public static void replaceView(View paramView)
  {
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.android.views.ViewUtil
 * JD-Core Version:    0.6.0
 */